import React from 'react'
import { NavLink,Outlet,useNavigate } from "react-router-dom";

export default function Home() {
    const navigate = useNavigate()
    const funcRoute = () => {
        navigate('msg',{
            state:{
                name:'func name'
            }
        })
    }
    return (
        <div>
            <h1>我是home</h1>
            {/* params类型参数 */}
            {/* <NavLink to='msg/params name'>msg</NavLink> */}

            {/* state类型参数 */}
            <NavLink to='msg' state={{ name:'state name' }}>msg</NavLink>

            {/* 编程式路由导航 */}
            <button onClick={funcRoute} >编程跳转</button>
            <Outlet />
        </div>
        
    )
}